import request from '@/utils/request'
var group_name = 'user'
export default {
  save(user) { // 添加
    return request({
      url: `/${group_name}/save`,
      method: 'post',
      data: user
    })
  },
  login(user) { // 登录
    return request({
      url: `/${group_name}/login`,
      method: 'post',
      data: user
    })
  },
  qqLogin(param, loginType) { // 登录
    return request({
      url: `/${group_name}/qqLogin?accessToken=${param}&loginType=${loginType}`,
      method: 'get'
    })
  },
  register(user) { // 注册
    return request({
      url: `/${group_name}/register`,
      method: 'post',
      data: user
    })
  },
  getByPage(page) { // 分页查询
    return request({
      url: `/${group_name}/getByPage`,
      method: 'post',
      data: page
    })
  },
  getUserCollections(page) { // 查询收藏
    return request({
      url: `/${group_name}/getUserCollections`,
      method: 'post',
      data: page
    })
  },
  getUserComments(page) { // 查询评论
    return request({
      url: `/${group_name}/getUserComments`,
      method: 'post',
      data: page
    })
  },
  update(user) { // 更新
    return request({
      url: `/${group_name}/update`,
      method: 'put',
      data: user
    })
  },
  updatePassword(user) { // 更新
    return request({
      url: `/${group_name}/updatePassword`,
      method: 'put',
      data: user
    })
  },
  deleteById(id) { // 删除
    return request({
      url: `/${group_name}/delete/${id}`,
      method: 'delete'
    })
  },
  deleteByIds(ids) { // 删除
    return request({
      url: `/${group_name}/deleteByIds`,
      method: 'delete',
      data: ids
    })
  },
  get(id) { // 根据id查询
    return request({
      url: `/${group_name}/get/${id}`,
      method: 'get'
    })
  },
  resetPwd(id) {
    return request({
      url: `${group_name}/resetPwd/${id}`,
      method: 'put'
    })
  },
  resetPwdByIds(ids) {
    return request({
      url: `${group_name}/resetPwdByIds`,
      method: 'put',
      data: ids
    })
  },
  userLogOut() { // 退出
    return request({
      url: `${group_name}/logOut`,
      method: 'post'
    })
  }
}
